package org.example.maven.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.example.maven.pojo.operation.loginLog.AddLoginLog;
import org.example.maven.pojo.operation.loginLog.LoginLogList;
import org.example.maven.pojo.operation.loginLog.SearchLoginLog;

import java.util.List;

@Mapper
public interface LoginLogMapper {
    //获取登录日志的list信息
    @Select("select *from login_log_user")
    List<LoginLogList> getLoginLog();

    //获取total数
    Integer getLoginLogCount(SearchLoginLog searchLoginLog);

    //添加用户登录的日志信息
    @Insert("insert into login_log(user_id,login_time,login_ip,login_address,user_agent,status,login_system,login_message) values " +
            "(#{userId},#{loginTime},#{loginIp},#{loginAddress},#{userAgent},#{status},#{loginSystem},#{loginMessage})")
    void addLoginLog(AddLoginLog addLoginLog);

    //删除日志
    void deleteLoginLog(String[]id);

    //获取特定的登录日志
    List<LoginLogList> getSpecieLoginLog(SearchLoginLog searchLoginLog);

    //删除全部登录日志
    @Delete("delete from login_log")
    void deleteLoginLogAll();
}
